package jrain.fw.sql.parser.expr;

public class IfExpression extends SqlExpression {

	private String condition;
	private SqlExpression ifExpr;
	private SqlExpression elseExpr;

	public String getCondition() {
		return condition;
	}

	public void setCondition(String condition) {
		this.condition = condition;
	}

	public SqlExpression getIfExpr() {
		return ifExpr;
	}

	public void setIfExpr(SqlExpression ifExpr) {
		this.ifExpr = ifExpr;
	}

	public SqlExpression getElseExpr() {
		return elseExpr;
	}

	public void setElseExpr(SqlExpression elseExpr) {
		this.elseExpr = elseExpr;
	}

	@Override
	public String calcSql() {
		String sql = "if("+ condition+"){"+ifExpr.calcSql()+"}else{ "+elseExpr.calcSql()+"}";
		return sql;
	}

}
